﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ArtMath
{
    public class clsFS : clsFormulaBase
    {
        clsFormulaBase fz, fm;
        public clsFS(PictureBox pb, clsFormulaBase fz, clsFormulaBase fm) : base(pb)
        {
            FZ = fz;
            FM = fm;
            Size = new SizeD(Math.Max(fz.Size.Width, fm.Size.Width), fz.Size.Height + fm.Size.Height + 8);
        }
        public clsFormulaBase FZ
        {
            get { return fz; }
            set
            {
                fz = value;
                picturebox.Invalidate();
            }
        }
        public clsFormulaBase FM
        {
            get { return fm; }
            set
            {
                fm = value;
                picturebox.Invalidate();
            }
        }
        public override void setChildLocation()
        {
            fz.Location = Location;
            fm.Location = new PointD(Location.X, fz.Bottom + 8);
        }
        public override void Paint(Graphics gra)
        {
            fz.Paint(gra);
            fm.Paint(gra);
            gra.DrawLine(new Pen(Color.Black, 2), (float)Location.X, (float)fz.Bottom + 4, (float)(Location.X + Size.Width), (float)fz.Bottom + 4);
            base.Paint(gra);
        }
        public override string ToString()
        {
            return "(" + fz.ToString() + ")/(" + fm.ToString() + ")";
        }
    }
}
